<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%@include file="DBHelper.jsp" %>
<%!
    public String ms_Action;
    public String ms_ActionDesc="";
    public String ms_ID="";
    public String ms_BookmarkName="";
    public String ms_BookmarkDesc="";
    public String ms_BookmarkText="";

 %>
<%
    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    ms_Action = request.getParameter("action") + "";
    ms_ID = request.getParameter("id");
    if (!isNullOrEmpty(ms_ID)){
            ms_ActionDesc = "修改";
            //判断是否存在相同标签
            String s_sql = "select * from eWebOffice_T_BookMark where D_ID = " + ms_ID;
            con = getConn();
             rs = ExecuteQuery(con,s_sql);
            if (rs.next())
            {
                ms_BookmarkName = rs.getString("D_BookMarkName");
                ms_BookmarkDesc = rs.getString("D_BookMarkDesc");
                ms_BookmarkText = rs.getString("D_BookMarkText");
            }
            else
            {
                response.getWriter().write("<script>alert('数据库不存在此标签!');window.location='bookmark_list.jsp';</script>");
            }
            closeAll(con,stmt,rs);
    }else{
        ms_ID="";
        ms_ActionDesc = "新增";
    }
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>书签管理</title>
<link rel="Stylesheet" type="text/css" href="css/eweboffice.css" />
<script type="text/javascript">
function DoCheckSubmit(){
    if (document.form1.d_bookmarkname.value == ""){
        alert("请输入书签名称！");
        return false;
    }
    return true;
}
</script>

</head>
<body>
<div id="bdy">

<form name=form1 action="bookmark_save.jsp" method="post" onsubmit="return DoCheckSubmit();">
<input type=hidden name=d_id value="<%=ms_ID %>" />
<table class="edit">
<tr>
    <td>书签名称</td>
    <td><input type="text" name="d_bookmarkname" size="50" class="txt" value="<%=ms_BookmarkName %>"></td>
</tr>
<tr>
    <td>书签说明</td>
    <td><input type="text" name="d_bookmarkdesc" size="50" class="txt" value="<%=ms_BookmarkDesc %>"></td>
</tr>
<tr>
    <td>书签备注</td>
    <td><input type="text" name="d_bookmarktext" size="50" class="txt" value="<%=ms_BookmarkText %>"></td>
</tr>
<tr>
    <td colspan="2">
        <input type="submit" value=" 保 存 " class="btn">
        <input type="reset" value=" 重 填 " class="btn">
        <input type="button" value=" 返 回 " onclick="history.back();" class="btn">
    </td>
</tr>
</table>
</form>

</div>
</body>
</html>

 